import 'package:f200/common/index.dart';
import 'package:f200/models/goods/goods_model.dart';
import 'package:flutter/material.dart';
import 'package:get/get.dart';

class GoodsDetailController extends GetxController {
  RxBool hideBackToTop = true.obs;
  var productId = "0";
  late GoodsModel goodsInfo;
  GoodsModel get goods => goodsInfo;

  late final ScrollController mainScrollCtr;

  List<String> mainImages = <String>[
    'assets/images/goods_detail1.jpg',
    'assets/images/goods_detail2.jpg',
    'assets/images/goods_detail3.jpg',
    'assets/images/goods_detail4.jpg',
  ];

  List<GoodsModel> goodsList = <GoodsModel>[
    GoodsModel(
      id: 1,
      title: '超威 榄菊蚊香盘艾草清香型40圈*3盒 菊蚊香盘艾草清香型40圈*3盒',
      thumbnail:
          'https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fimg.alicdn.com%2Fbao%2Fuploaded%2Fi1%2F2200637085591%2FO1CN01Kv7bO81rAiypaixNo_%21%212200637085591.jpg&refer=http%3A%2F%2Fimg.alicdn.com&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=auto?sec=1700529378&t=a2c3e8c69c66adb90bdf386fdfe066d1',
      originPrice: 20.0,
      price: 19.90,
      subTitle: '榄菊蚊香',
      salesTag: <String>['赠运费险', '先用后付', '包邮'],
      evaluate: 10,
      favourable: 97,
      repeatCustomer: 10000,
      score: 4.6,
    ),
    GoodsModel(
      id: 2,
      title:
          '超威 榄菊蚊香盘艾草清香型40圈*3盒 超威 榄菊蚊香盘艾草清香型40圈*3盒 超威 榄菊蚊香盘艾草清香型40圈*3盒 超威 榄菊蚊香盘艾草清香型40圈*3盒',
      thumbnail:
          'https://pic3.zhimg.com/v2-9bb3490420ab1ab419199e16b282a722_r.jpg',
      originPrice: 20.0,
      price: 19.90,
      subTitle: '榄菊蚊香',
      salesTag: <String>['赠运费险', '先用后付', '包邮'],
      evaluate: 10,
      favourable: 97,
      repeatCustomer: 10000,
      score: 4.6,
    ),
    GoodsModel(
      id: 3,
      title: '超威 榄菊蚊香盘艾草清香型40圈*3盒',
      thumbnail:
          'https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fimg.alicdn.com%2Fbao%2Fuploaded%2Fi3%2F735405015%2FO1CN012HmC891muuyuX8FZ8_%21%210-item_pic.jpg&refer=http%3A%2F%2Fimg.alicdn.com&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=auto?sec=1700529414&t=73c888557827e05daa9e37958362dd27',
      originPrice: 20.0,
      price: 19.90,
      subTitle: '榄菊蚊香',
      salesTag: <String>['赠运费险', '先用后付', '包邮'],
      evaluate: 10,
      favourable: 97,
      repeatCustomer: 10000,
      score: 4.6,
    ),
    GoodsModel(
      id: 4,
      title: '超威 榄菊蚊香盘艾草清香型40圈*3盒',
      thumbnail:
          'https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fimg.alicdn.com%2Fbao%2Fuploaded%2Fi3%2F735405015%2FO1CN012HmC891muuyuX8FZ8_%21%210-item_pic.jpg&refer=http%3A%2F%2Fimg.alicdn.com&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=auto?sec=1700529414&t=73c888557827e05daa9e37958362dd27',
      originPrice: 20.0,
      price: 19.90,
      subTitle: '榄菊蚊香',
      salesTag: <String>['赠运费险', '先用后付', '包邮'],
      evaluate: 10,
      favourable: 97,
      repeatCustomer: 10000,
      score: 4.6,
    ),
    GoodsModel(
      id: 5,
      title: '超威 榄菊蚊香盘艾草清香型40圈*3盒',
      thumbnail:
          'https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fimg.alicdn.com%2Fbao%2Fuploaded%2Fi3%2F735405015%2FO1CN012HmC891muuyuX8FZ8_%21%210-item_pic.jpg&refer=http%3A%2F%2Fimg.alicdn.com&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=auto?sec=1700529414&t=73c888557827e05daa9e37958362dd27',
      originPrice: 20.0,
      price: 19.90,
      subTitle: '榄菊蚊香',
      salesTag: <String>['赠运费险', '先用后付', '包邮'],
      evaluate: 10,
      favourable: 97,
      repeatCustomer: 10000,
      score: 4.6,
    ),
    GoodsModel(
      id: 6,
      title: '超威 榄菊蚊香盘艾草清香型40圈*3盒',
      thumbnail:
          'https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fimg.alicdn.com%2Fbao%2Fuploaded%2Fi3%2F735405015%2FO1CN012HmC891muuyuX8FZ8_%21%210-item_pic.jpg&refer=http%3A%2F%2Fimg.alicdn.com&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=auto?sec=1700529414&t=73c888557827e05daa9e37958362dd27',
      originPrice: 20.0,
      price: 19.90,
      subTitle: '榄菊蚊香',
      salesTag: <String>['赠运费险', '先用后付', '包邮'],
      evaluate: 10,
      favourable: 97,
      repeatCustomer: 10000,
      score: 4.6,
    ),
    GoodsModel(
      id: 7,
      title: '超威 榄菊蚊香盘艾草清香型40圈*3盒',
      thumbnail:
          'https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fimg.alicdn.com%2Fbao%2Fuploaded%2Fi3%2F735405015%2FO1CN012HmC891muuyuX8FZ8_%21%210-item_pic.jpg&refer=http%3A%2F%2Fimg.alicdn.com&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=auto?sec=1700529414&t=73c888557827e05daa9e37958362dd27',
      originPrice: 20.0,
      price: 19.90,
      subTitle: '榄菊蚊香',
      salesTag: <String>['赠运费险', '先用后付', '包邮'],
      evaluate: 10,
      favourable: 97,
      repeatCustomer: 10000,
      score: 4.6,
    ),
    GoodsModel(
      id: 8,
      title: '超威 榄菊蚊香盘艾草清香型40圈*3盒',
      thumbnail:
          'https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fimg.alicdn.com%2Fbao%2Fuploaded%2Fi3%2F735405015%2FO1CN012HmC891muuyuX8FZ8_%21%210-item_pic.jpg&refer=http%3A%2F%2Fimg.alicdn.com&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=auto?sec=1700529414&t=73c888557827e05daa9e37958362dd27',
      originPrice: 20.0,
      price: 19.90,
      subTitle: '榄菊蚊香',
      salesTag: <String>['赠运费险', '先用后付', '包邮'],
      evaluate: 10,
      favourable: 97,
      repeatCustomer: 10000,
      score: 4.6,
    ),
    GoodsModel(
      id: 9,
      title: '超威 榄菊蚊香盘艾草清香型40圈*3盒',
      thumbnail:
          'https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fimg.alicdn.com%2Fbao%2Fuploaded%2Fi3%2F735405015%2FO1CN012HmC891muuyuX8FZ8_%21%210-item_pic.jpg&refer=http%3A%2F%2Fimg.alicdn.com&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=auto?sec=1700529414&t=73c888557827e05daa9e37958362dd27',
      originPrice: 20.0,
      price: 19.90,
      subTitle: '榄菊蚊香',
      salesTag: <String>['赠运费险', '先用后付', '包邮'],
      evaluate: 10,
      favourable: 97,
      repeatCustomer: 10000,
      score: 4.6,
    ),
    GoodsModel(
      id: 10,
      title: '超威 榄菊蚊香盘艾草清香型40圈*3盒',
      thumbnail:
          'https://pic3.zhimg.com/v2-9bb3490420ab1ab419199e16b282a722_r.jpg',
      originPrice: 20.0,
      price: 19.90,
      subTitle: '榄菊蚊香',
      salesTag: <String>['赠运费险', '先用后付', '包邮'],
      evaluate: 10,
      favourable: 97,
      repeatCustomer: 10000,
      score: 4.6,
    ),
    //一页
    GoodsModel(
      id: 1,
      title: '超威 榄菊蚊香盘艾草清香型40圈*3盒 菊蚊香盘艾草清香型40圈*3盒',
      thumbnail:
          'https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fimg.alicdn.com%2Fbao%2Fuploaded%2Fi1%2F2200637085591%2FO1CN01Kv7bO81rAiypaixNo_%21%212200637085591.jpg&refer=http%3A%2F%2Fimg.alicdn.com&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=auto?sec=1700529378&t=a2c3e8c69c66adb90bdf386fdfe066d1',
      originPrice: 20.0,
      price: 19.90,
      subTitle: '榄菊蚊香',
      salesTag: <String>['赠运费险', '先用后付', '包邮'],
      evaluate: 10,
      favourable: 97,
      repeatCustomer: 10000,
      score: 4.6,
    ),
    GoodsModel(
      id: 1,
      title: '超威 榄菊蚊香盘艾草清香型40圈*3盒',
      thumbnail:
          'https://pic3.zhimg.com/v2-9bb3490420ab1ab419199e16b282a722_r.jpg',
      originPrice: 20.0,
      price: 19.90,
      subTitle: '榄菊蚊香',
      salesTag: <String>['赠运费险', '先用后付', '包邮'],
      evaluate: 10,
      favourable: 97,
      repeatCustomer: 10000,
      score: 4.6,
    ),
    GoodsModel(
      id: 1,
      title: '超威 榄菊蚊香盘艾草清香型40圈*3盒',
      thumbnail:
          'https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fimg.alicdn.com%2Fbao%2Fuploaded%2Fi3%2F735405015%2FO1CN012HmC891muuyuX8FZ8_%21%210-item_pic.jpg&refer=http%3A%2F%2Fimg.alicdn.com&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=auto?sec=1700529414&t=73c888557827e05daa9e37958362dd27',
      originPrice: 20.0,
      price: 19.90,
      subTitle: '榄菊蚊香',
      salesTag: <String>['赠运费险', '先用后付', '包邮'],
      evaluate: 10,
      favourable: 97,
      repeatCustomer: 10000,
      score: 4.6,
    ),
    GoodsModel(
      id: 1,
      title: '超威 榄菊蚊香盘艾草清香型40圈*3盒',
      thumbnail:
          'https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fimg.alicdn.com%2Fbao%2Fuploaded%2Fi3%2F735405015%2FO1CN012HmC891muuyuX8FZ8_%21%210-item_pic.jpg&refer=http%3A%2F%2Fimg.alicdn.com&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=auto?sec=1700529414&t=73c888557827e05daa9e37958362dd27',
      originPrice: 20.0,
      price: 19.90,
      subTitle: '榄菊蚊香',
      salesTag: <String>['赠运费险', '先用后付', '包邮'],
      evaluate: 10,
      favourable: 97,
      repeatCustomer: 10000,
      score: 4.6,
    ),
    GoodsModel(
      id: 1,
      title: '超威 榄菊蚊香盘艾草清香型40圈*3盒',
      thumbnail:
          'https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fimg.alicdn.com%2Fbao%2Fuploaded%2Fi3%2F735405015%2FO1CN012HmC891muuyuX8FZ8_%21%210-item_pic.jpg&refer=http%3A%2F%2Fimg.alicdn.com&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=auto?sec=1700529414&t=73c888557827e05daa9e37958362dd27',
      originPrice: 20.0,
      price: 19.90,
      subTitle: '榄菊蚊香',
      salesTag: <String>['赠运费险', '先用后付', '包邮'],
      evaluate: 10,
      favourable: 97,
      repeatCustomer: 10000,
      score: 4.6,
    ),
    GoodsModel(
      id: 1,
      title: '超威 榄菊蚊香盘艾草清香型40圈*3盒',
      thumbnail:
          'https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fimg.alicdn.com%2Fbao%2Fuploaded%2Fi3%2F735405015%2FO1CN012HmC891muuyuX8FZ8_%21%210-item_pic.jpg&refer=http%3A%2F%2Fimg.alicdn.com&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=auto?sec=1700529414&t=73c888557827e05daa9e37958362dd27',
      originPrice: 20.0,
      price: 19.90,
      subTitle: '榄菊蚊香',
      salesTag: <String>['赠运费险', '先用后付', '包邮'],
      evaluate: 10,
      favourable: 97,
      repeatCustomer: 10000,
      score: 4.6,
    ),
    GoodsModel(
      id: 1,
      title: '超威 榄菊蚊香盘艾草清香型40圈*3盒',
      thumbnail:
          'https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fimg.alicdn.com%2Fbao%2Fuploaded%2Fi3%2F735405015%2FO1CN012HmC891muuyuX8FZ8_%21%210-item_pic.jpg&refer=http%3A%2F%2Fimg.alicdn.com&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=auto?sec=1700529414&t=73c888557827e05daa9e37958362dd27',
      originPrice: 20.0,
      price: 19.90,
      subTitle: '榄菊蚊香',
      salesTag: <String>['赠运费险', '先用后付', '包邮'],
      evaluate: 10,
      favourable: 97,
      repeatCustomer: 10000,
      score: 4.6,
    ),
    GoodsModel(
      id: 1,
      title: '超威 榄菊蚊香盘艾草清香型40圈*3盒',
      thumbnail:
          'https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fimg.alicdn.com%2Fbao%2Fuploaded%2Fi3%2F735405015%2FO1CN012HmC891muuyuX8FZ8_%21%210-item_pic.jpg&refer=http%3A%2F%2Fimg.alicdn.com&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=auto?sec=1700529414&t=73c888557827e05daa9e37958362dd27',
      originPrice: 20.0,
      price: 19.90,
      subTitle: '榄菊蚊香',
      salesTag: <String>['赠运费险', '先用后付', '包邮'],
      evaluate: 10,
      favourable: 97,
      repeatCustomer: 10000,
      score: 4.6,
    ),
    GoodsModel(
      id: 1,
      title: '超威 榄菊蚊香盘艾草清香型40圈*3盒',
      thumbnail:
          'https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fimg.alicdn.com%2Fbao%2Fuploaded%2Fi3%2F735405015%2FO1CN012HmC891muuyuX8FZ8_%21%210-item_pic.jpg&refer=http%3A%2F%2Fimg.alicdn.com&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=auto?sec=1700529414&t=73c888557827e05daa9e37958362dd27',
      originPrice: 20.0,
      price: 19.90,
      subTitle: '榄菊蚊香',
      salesTag: <String>['赠运费险', '先用后付', '包邮'],
      evaluate: 10,
      favourable: 97,
      repeatCustomer: 10000,
      score: 4.6,
    ),
    GoodsModel(
      id: 1,
      title: '超威 榄菊蚊香盘艾草清香型40圈*3盒',
      thumbnail:
          'https://pic3.zhimg.com/v2-9bb3490420ab1ab419199e16b282a722_r.jpg',
      originPrice: 20.0,
      price: 19.90,
      subTitle: '榄菊蚊香',
      salesTag: <String>['赠运费险', '先用后付', '包邮'],
      evaluate: 10,
      favourable: 97,
      repeatCustomer: 10000,
      score: 4.6,
    ),
    //一页
    GoodsModel(
      id: 1,
      title: '超威 榄菊蚊香盘艾草清香型40圈*3盒 菊蚊香盘艾草清香型40圈*3盒',
      thumbnail:
          'https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fimg.alicdn.com%2Fbao%2Fuploaded%2Fi1%2F2200637085591%2FO1CN01Kv7bO81rAiypaixNo_%21%212200637085591.jpg&refer=http%3A%2F%2Fimg.alicdn.com&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=auto?sec=1700529378&t=a2c3e8c69c66adb90bdf386fdfe066d1',
      originPrice: 20.0,
      price: 19.90,
      subTitle: '榄菊蚊香',
      salesTag: <String>['赠运费险', '先用后付', '包邮'],
      evaluate: 10,
      favourable: 97,
      repeatCustomer: 10000,
      score: 4.6,
    ),
    GoodsModel(
      id: 1,
      title: '超威 榄菊蚊香盘艾草清香型40圈*3盒',
      thumbnail:
          'https://pic3.zhimg.com/v2-9bb3490420ab1ab419199e16b282a722_r.jpg',
      originPrice: 20.0,
      price: 19.90,
      subTitle: '榄菊蚊香',
      salesTag: <String>['赠运费险', '先用后付', '包邮'],
      evaluate: 10,
      favourable: 97,
      repeatCustomer: 10000,
      score: 4.6,
    ),
    GoodsModel(
      id: 1,
      title: '超威 榄菊蚊香盘艾草清香型40圈*3盒',
      thumbnail:
          'https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fimg.alicdn.com%2Fbao%2Fuploaded%2Fi3%2F735405015%2FO1CN012HmC891muuyuX8FZ8_%21%210-item_pic.jpg&refer=http%3A%2F%2Fimg.alicdn.com&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=auto?sec=1700529414&t=73c888557827e05daa9e37958362dd27',
      originPrice: 20.0,
      price: 19.90,
      subTitle: '榄菊蚊香',
      salesTag: <String>['赠运费险', '先用后付', '包邮'],
      evaluate: 10,
      favourable: 97,
      repeatCustomer: 10000,
      score: 4.6,
    ),
    GoodsModel(
      id: 1,
      title: '超威 榄菊蚊香盘艾草清香型40圈*3盒',
      thumbnail:
          'https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fimg.alicdn.com%2Fbao%2Fuploaded%2Fi3%2F735405015%2FO1CN012HmC891muuyuX8FZ8_%21%210-item_pic.jpg&refer=http%3A%2F%2Fimg.alicdn.com&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=auto?sec=1700529414&t=73c888557827e05daa9e37958362dd27',
      originPrice: 20.0,
      price: 19.90,
      subTitle: '榄菊蚊香',
      salesTag: <String>['赠运费险', '先用后付', '包邮'],
      evaluate: 10,
      favourable: 97,
      repeatCustomer: 10000,
      score: 4.6,
    ),
    GoodsModel(
      id: 1,
      title: '超威 榄菊蚊香盘艾草清香型40圈*3盒',
      thumbnail:
          'https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fimg.alicdn.com%2Fbao%2Fuploaded%2Fi3%2F735405015%2FO1CN012HmC891muuyuX8FZ8_%21%210-item_pic.jpg&refer=http%3A%2F%2Fimg.alicdn.com&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=auto?sec=1700529414&t=73c888557827e05daa9e37958362dd27',
      originPrice: 20.0,
      price: 19.90,
      subTitle: '榄菊蚊香',
      salesTag: <String>['赠运费险', '先用后付', '包邮'],
      evaluate: 10,
      favourable: 97,
      repeatCustomer: 10000,
      score: 4.6,
    ),
    GoodsModel(
      id: 1,
      title: '超威 榄菊蚊香盘艾草清香型40圈*3盒',
      thumbnail:
          'https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fimg.alicdn.com%2Fbao%2Fuploaded%2Fi3%2F735405015%2FO1CN012HmC891muuyuX8FZ8_%21%210-item_pic.jpg&refer=http%3A%2F%2Fimg.alicdn.com&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=auto?sec=1700529414&t=73c888557827e05daa9e37958362dd27',
      originPrice: 20.0,
      price: 19.90,
      subTitle: '榄菊蚊香',
      salesTag: <String>['赠运费险', '先用后付', '包邮'],
      evaluate: 10,
      favourable: 97,
      repeatCustomer: 10000,
      score: 4.6,
    ),
    GoodsModel(
      id: 1,
      title: '超威 榄菊蚊香盘艾草清香型40圈*3盒',
      thumbnail:
          'https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fimg.alicdn.com%2Fbao%2Fuploaded%2Fi3%2F735405015%2FO1CN012HmC891muuyuX8FZ8_%21%210-item_pic.jpg&refer=http%3A%2F%2Fimg.alicdn.com&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=auto?sec=1700529414&t=73c888557827e05daa9e37958362dd27',
      originPrice: 20.0,
      price: 19.90,
      subTitle: '榄菊蚊香',
      salesTag: <String>['赠运费险', '先用后付', '包邮'],
      evaluate: 10,
      favourable: 97,
      repeatCustomer: 10000,
      score: 4.6,
    ),
    GoodsModel(
      id: 1,
      title: '超威 榄菊蚊香盘艾草清香型40圈*3盒',
      thumbnail:
          'https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fimg.alicdn.com%2Fbao%2Fuploaded%2Fi3%2F735405015%2FO1CN012HmC891muuyuX8FZ8_%21%210-item_pic.jpg&refer=http%3A%2F%2Fimg.alicdn.com&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=auto?sec=1700529414&t=73c888557827e05daa9e37958362dd27',
      originPrice: 20.0,
      price: 19.90,
      subTitle: '榄菊蚊香',
      salesTag: <String>['赠运费险', '先用后付', '包邮'],
      evaluate: 10,
      favourable: 97,
      repeatCustomer: 10000,
      score: 4.6,
    ),
    GoodsModel(
      id: 1,
      title: '超威 榄菊蚊香盘艾草清香型40圈*3盒',
      thumbnail:
          'https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fimg.alicdn.com%2Fbao%2Fuploaded%2Fi3%2F735405015%2FO1CN012HmC891muuyuX8FZ8_%21%210-item_pic.jpg&refer=http%3A%2F%2Fimg.alicdn.com&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=auto?sec=1700529414&t=73c888557827e05daa9e37958362dd27',
      originPrice: 20.0,
      price: 19.90,
      subTitle: '榄菊蚊香',
      salesTag: <String>['赠运费险', '先用后付', '包邮'],
      evaluate: 10,
      favourable: 97,
      repeatCustomer: 10000,
      score: 4.6,
    ),
    GoodsModel(
      id: 1,
      title: '超威 榄菊蚊香盘艾草清香型40圈*3盒',
      thumbnail:
          'https://pic3.zhimg.com/v2-9bb3490420ab1ab419199e16b282a722_r.jpg',
      originPrice: 20.0,
      price: 19.90,
      subTitle: '榄菊蚊香',
      salesTag: <String>['赠运费险', '先用后付', '包邮'],
      evaluate: 10,
      favourable: 97,
      repeatCustomer: 10000,
      score: 4.6,
    ),
  ];

  @override
  void onInit() {
    super.onInit();
    //mock
    productId = "1";
    fetchProductInfo();

    mainScrollCtr = ScrollController();
    mainScrollCtr.addListener(() {
      if (mainScrollCtr.position.pixels >= 800) {
        hideBackToTop.value = false;
      } else {
        hideBackToTop.value = true;
      }
    });
  }

  @override
  void onClose() {
    super.onClose();
    mainScrollCtr.dispose();
  }

  void fetchProductInfo() {
    //获取商品ID
    productId = Get.parameters['id'] ?? '1';
    logI('商品ID： $productId');

    var info = goodsList.firstWhere(
        (element) => element.id.toString() == productId,
        orElse: null);
    if (info == null) throw Exception('找不到改商品信息');
    goodsInfo = info;
  }

  void backToTop() {
    mainScrollCtr.animateTo(0,
        duration: Duration(milliseconds: 300), curve: Curves.ease);
  }
}
